package com.samehope.ar.mapper;

import com.samehope.ar.entity.PatrolPointGroup;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.samehope.ar.vo.FormSelectVO;
import com.samehope.ar.vo.TreeDataVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 巡检点分组表 Mapper 接口
 * </p>
 *
 * @author Zhang Luo
 * @since 2019-12-23
 */
public interface PatrolPointGroupMapper extends BaseMapper<PatrolPointGroup> {

    /**
     * 根据项目和分组名称查找分组
     * @param projectId
     * @param name
     * @return
     */
    PatrolPointGroup findByProjectAndGroupName(@Param("projectId") Long projectId,
                                               @Param("name") String name);

    /**
     * 根据项目和分组ID查找分组
     * @param projectId
     * @param groupId
     * @return
     */
    PatrolPointGroup findByProjectAndGroup(@Param("projectId") Long projectId,
                                           @Param("groupId") Long groupId);

    /**
     * 查询巡检点分组树结构
     * @param projectId
     * @param condition
     * @return
     */
    List<TreeDataVO> getGroupTreeByProjectAndCondition(@Param("projectId") Long projectId,
                                                 @Param("condition") String condition);

    /**
     * 巡检点分组下拉框视图对象
     * @param projectId
     * @return
     */
    List<FormSelectVO> getGroupsForSelectByProject(Long projectId);
}
